<?php
/**
 * Creates a form for admin to login
 * 
 * @package Admin
 * @subpackage Admin_Form
 * @version $Id: LoginForm.php 1933 2010-10-22 11:52:10Z CYBERSOFT\anhtt $
 */
class Admin_Form_LoginForm extends Zend_Form
{
	/**
	 * Admin Login Form Constructor
	 */
	public function init()
	{
		$loginName = new Zend_Form_Element_Text('loginName', 
				array('disableLoadDefaultDecorators' => TRUE));
		$loginName->autocomplete = 'off';
		$loginName->setRequired(TRUE);	
		$loginName->setAttrib('size', '30');
		$loginName->setAttrib('maxlength', '30');
		$loginName->addDecorator("ViewHelper");
		$loginName->addFilter(new Zend_Filter_StringTrim());
		$loginName->addFilter(new Zend_Filter_StripTags());
		$loginName->addValidator(
				new Zend_Validate_StringLength(array(
							'min' => '4',
							'max' => '15'			
				)));		
		$loginName->addValidator(new Admin_Library_Validate_ValidateUserInput());		
		$this->addElement($loginName);
		//add password element
		$password = new Zend_Form_Element_Password('password', 
				array('disableLoadDefaultDecorators' => TRUE));
		$password->setRequired(TRUE);
		$password->setAttrib('size', '30');
		$password->setAttrib('maxlength', '30');
		$password->addFilter(new Zend_Filter_StringTrim());
		$password->addFilter(new Zend_Filter_StripTags());
		$password->addDecorator("ViewHelper");
		$password->addValidator(
				new Zend_Validate_StringLength(array(
							'min' => '6',
							'max' => '15'
				)));
		$this->addElement($password);
		
		$this->clearDecorators();
		$this->addDecorator("FormElements");
		$this->addDecorator("Form");
	}
}